<?php
namespace BP\Sys;

use BP\En\EntityMyPK;

require_once("BP/En/Map.php");
require_once("BP/Web/WebUser.php");
class MapFrame extends EntityMyPK {
	public $IsUse;	// boolean
	private function __init() { // default class members
		$this->IsUse =  FALSE ;
	}
	public function getHisUAC () 
	{
		$uac = new UAC();
		if ($WebUser->getNo()->equals("admin"))
		{
			$uac->IsDelete =  TRUE ;
			$uac->IsUpdate =  TRUE ;
		}
		return $uac;
	}
	public function getIsAutoSize () 
	{
		return $this->GetValBooleanByKey(MapFrameAttr::$IsAutoSize);
	}
	public function setIsAutoSize ($value) // [boolean value]
	{
		$this->SetValByKey(MapFrameAttr::$IsAutoSize, $value);
	}
	public function getName () 
	{
		return $this->GetValStrByKey(MapFrameAttr::$Name);
	}
	public function setName ($value) // [String value]
	{
		$this->SetValByKey(MapFrameAttr::$Name, $value);
	}
	public function getFrmID () 
	{
		return $this->GetValStrByKey(MapFrameAttr::$FrmID);
	}
	public function setFrmID ($value) // [String value]
	{
		$this->SetValByKey(MapFrameAttr::$FrmID, $value);
	}
	public function getEleType () 
	{
		return $this->GetValStrByKey(FrmEleAttr::$EleType);
	}
	public function setEleType ($value) // [String value]
	{
		$this->SetValByKey(FrmEleAttr::$EleType, $value);
	}
	public function getURL () 
	{
		$s = $this->GetValStrByKey(MapFrameAttr::$FrameURL);
		if ($DataType->IsNullOrEmpty($s))
		{
			return "http://ccflow.org";
		}
		return $s;
	}
	public function setURL ($value) // [String value]
	{
		$this->SetValByKey(MapFrameAttr::$FrameURL, $value);
	}
	public function getX () 
	{
		return $this->GetValFloatByKey(FrmEleAttr::$X);
	}
	public function setX ($value) // [float value]
	{
		$this->SetValByKey(FrmEleAttr::$X, $value);
	}
	public function getY () 
	{
		return $this->GetValFloatByKey(FrmEleAttr::$Y);
	}
	public function setY ($value) // [float value]
	{
		$this->SetValByKey(FrmEleAttr::$Y, $value);
	}
	public function getH () 
	{
		return $this->GetValFloatByKey(MapFrameAttr::$H, 700);
	}
	public function setH ($value) // [float value]
	{
		$this->SetValByKey(MapFrameAttr::$H, $value);
	}
	public function getW () 
	{
		return $this->GetValFloatByKey(MapFrameAttr::$W);
	}
	public function setW ($value) // [float value]
	{
		$this->SetValByKey(MapFrameAttr::$W, $value);
	}
	public function getFK_MapData () 
	{
		return $this->GetValStrByKey(MapFrameAttr::$FK_MapData);
	}
	public function setFK_MapData ($value) // [String value]
	{
		$this->SetValByKey(MapFrameAttr::$FK_MapData, $value);
	}
	public static function constructor__ () 
	{
		$me = new self();
		$me->__init();
		return $me;
	}
	public static function constructor__String ($mypk) // [String mypk]
	{
		$me = new self();
		$me->__init();
		$me->setMyPK($mypk);
		$me->Retrieve();
		return $me;
	}
	public function getEnMap () 
	{
		if (($this->get_enMap() != NULL))
		{
			return $this->get_enMap();
		}
		$map = new Map("Sys_MapFrame", "框架");
		$map->Java_SetDepositaryOfEntity($Depositary->None);
		$map->Java_SetDepositaryOfMap($Depositary->Application);
		$map->Java_SetEnType($EnType->Sys);
		$map->AddMyPK();
		$map->AddTBString(MapFrameAttr::$FK_MapData, NULL, "表单ID",  TRUE ,  TRUE , 0, 100, 20);
		$map->AddTBString(MapFrameAttr::$Name, NULL, "名称",  TRUE ,  FALSE , 0, 200, 20,  TRUE );
		$map->AddTBString(MapFrameAttr::$URL, NULL, "URL",  TRUE ,  FALSE , 0, 3000, 20,  TRUE );
		$map->AddTBString(MapFrameAttr::$FrameURL, NULL, "FrameURL",  TRUE ,  FALSE , 0, 3000, 20,  TRUE );
		$map->AddTBInt(MapFrameAttr::$UrlSrcType, 0, "URL来源",  FALSE ,  FALSE );
		$map->AddTBString(FrmEleAttr::$Y, NULL, "Y",  TRUE ,  FALSE , 0, 20, 20);
		$map->AddTBString(FrmEleAttr::$X, NULL, "x",  TRUE ,  FALSE , 0, 20, 20);
		$map->AddTBString(FrmEleAttr::$W, NULL, "宽度",  TRUE ,  FALSE , 0, 20, 20);
		$map->AddTBString(FrmEleAttr::$H, NULL, "高度",  TRUE ,  FALSE , 0, 20, 20);
		$map->AddBoolean(MapFrameAttr::$IsAutoSize,  TRUE , "是否自动设置大小",  FALSE ,  FALSE );
		$map->AddTBString(FrmEleAttr::$EleType, NULL, "类型",  FALSE ,  FALSE , 0, 50, 20,  TRUE );
		$map->AddTBString(FrmEleAttr::$GUID, NULL, "GUID",  FALSE ,  FALSE , 0, 128, 20);
		$this->set_enMap($map);
		return $this->get_enMap();
	}
	protected function afterInsert () 
	{
		$gf = GroupField::constructor__();
		$gf->setFrmID($this->getFK_MapData());
		$gf->setCtrlID($this->getMyPK());
		$gf->setCtrlType("Frame");
		$gf->setLab($this->getName());
		$gf->setIdx(0);
		$gf->Insert();
		parent->afterInsert();
	}
	protected function afterDelete () 
	{
		$gf = GroupField::constructor__();
		$gf->Delete(GroupFieldAttr::$CtrlID, $this->getMyPK());
		parent->afterDelete();
	}
	protected function beforeUpdate () 
	{
		$gf = GroupField::constructor__();
		$gf->Retrieve(GroupFieldAttr::$CtrlID, $this->getMyPK());
		$gf->setLab($this->getName());
		$gf->Update();
		return parent->beforeUpdate();
	}
}
?>
